//
//  MJTComposeMenuButton.swift
//  swiftWeiBo
//
//  Created by MJT on 16/7/18.
//  Copyright © 2016年 MJT. All rights reserved.
//

import UIKit

class MJTComposeMenuButton: UIButton {

    override init(frame: CGRect) {
        super.init(frame: frame)
        setupUI()
    }
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    private func setupUI() {
        titleLabel?.font = UIFont.systemFontOfSize(15)
        setTitleColor(UIColor.grayColor(), forState: .Normal)
        titleLabel?.textAlignment = .Center
    }
    //重写highlighted属性
    override var highlighted: Bool {
        get {
            return false
        } set {

        }
    }
    // 调整子控件布局
    override func layoutSubviews() {
        super.layoutSubviews()
        // 设置子控件的宽度
        imageView?.y = 0
        imageView?.width = width
        imageView?.height = width

        titleLabel?.x = 0
        titleLabel?.y = width
        titleLabel?.width = width
        titleLabel?.height = height - width
    }
}
